<?php

namespace App\Listeners;

use App\Enum\CardEnum;
use App\Enum\LogsEnum;
use App\Enum\OrderEnum;
use App\Enum\SmsScheduleEnum;
use App\Enum\TravelEnum;
use App\Events\OrderCreated;
use App\Models\LogsModel;
use App\Models\OrderExtendModel;
use App\Models\OrderModel;
use App\Models\SmsScheduleModel;
use App\Models\VillagerUserModel;
use App\Services\OrderService;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;

class OrderCreatedNotification implements ShouldQueue
{
    public $queue='order-created';
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param OrderCreated $event
     * @return void
     * @throws \Exception
     */
    public function handle(OrderCreated $event)
    {
        try{
            OrderService::handleStatic($event->orderInfo);
        }catch (\Exception $e){
            Log::error( "下单后异步操作失败：".$e->getMessage());
        }
    }
}
